package com.xing.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.IOException;
import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.xing.common.vail.AddVailGroup;
import com.xing.common.vail.ListValue;
import com.xing.common.vail.UpdateVailGroup;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 品牌
 *
 * @author xingfuhao
 * @email 2030280200@qq.com
 * @date 2022-08-31 10:41:37
 */
@Data
@TableName("pms_brand")
public class BrandEntity extends JsonSerializer<Long> {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @TableId
    @JsonSerialize(using = BrandEntity.class)

    @NotNull(message = "修改必须指定品牌id",groups={UpdateVailGroup.class})
    @NotNull(message = "新增不能指定品牌id",groups={AddVailGroup.class})
    private Long brandId;
    /**
     * 品牌名
     */
    @NotBlank(message = "品牌名不能为空")
    private String name;
    /**
     * 品牌logo地址
     */
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */

    @NotNull(groups = {AddVailGroup.class,UpdateVailGroup.class})
    @ListValue(value = {0,1},groups = {AddVailGroup.class,UpdateVailGroup.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotEmpty
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull
    @Min(0)
    private Integer sort;


    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getBrandId() {
        return brandId;
    }

    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    public Integer getShowStatus() {
        return showStatus;
    }

    public void setShowStatus(Integer showStatus) {
        this.showStatus = showStatus;
    }

    public String getFirstLetter() {
        return firstLetter;
    }

    public void setFirstLetter(String firstLetter) {
        this.firstLetter = firstLetter;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    @Override
    public void serialize(Long aLong, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeString(Long.toString(aLong));
    }
}
